﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations.Schema;
using LX.Web.Excel;

namespace S4Store.Domain.CarKpi
{
    public class CarKpiDayData 
    {
        public int Id { get; set; }

        /// <summary>
        /// 是否确认
        /// </summary>
        public bool IsConfirmed { get; set; }

        /// <summary>
        /// 日期
        /// </summary>
        public DateTime Date { get; set; }

        [Import("车款", typeof(CarModel))]
        public int CarModelId { get; set; }
        /// <summary>
        /// 店
        /// </summary>
        public int StoreId { get; set; }

        public virtual CarModel CarModel { get; set; }
        /// <summary>
        /// 店
        /// </summary>
        public virtual Store Store { get; set; }

        /// <summary>
        /// 本店已定
        /// </summary>
        [Import("本店订车")]
        public int BDYD { get; set; }
        /// <summary>
        /// 二网已定
        /// </summary>
        [Import("二网订车")]
        public int EWYD { get; set; }
        /// <summary>
        /// A类库存
        /// </summary>
        [Import("A类库存")]
        public int AKC { get; set; }
        /// <summary>
        /// B类库存
        /// </summary>
        [Import("B类库存")]
        public int BKC { get; set; }
        /// <summary>
        /// C类库存
        /// </summary>
        [Import("C类库存")]
        public int CKC { get; set; }
        /// <summary>
        /// 在途
        /// </summary>
        public int ZT { get; set; }
        /// <summary>
        /// C类库龄
        /// </summary>
        [Import("C类库龄")]
        public int CKL { get; set; }
        /// <summary>
        /// 预提
        /// </summary>
        public int YT { get; set; }
        /// <summary>
        /// 已交-二网
        /// </summary>
        [Import("二网已交")]
        public int EWYJ { get; set; }
        /// <summary>
        /// 已交-本站
        /// </summary>
        [Import("本店已交")]
        public int BDYJ { get; set; }
        /// <summary>
        /// H有望客户
        /// </summary>
        [Import("H级有望客户")]
        public int HYWKH { get; set; }
        /// <summary>
        /// A有望客户
        /// </summary>
        [Import("A级有望客户")]
        public int AYWKH { get; set; }
        /// <summary>
        /// B有望客户
        /// </summary>
        [Import("B级有望客户")]
        public int BYWKH { get; set; }
        /// <summary>
        /// H登记客户
        /// </summary>
        [Import("H级登记客户")]
        public int HDJKH { get; set; }
        /// <summary>
        /// A登记客户
        /// </summary>
        [Import("A级登记客户")]
        public int ADJKH { get; set; }
        /// <summary>
        /// B登记客户
        /// </summary>
        [Import("B级登记客户")]
        public int BDJKH { get; set; }
        /// <summary>
        /// 投保
        /// </summary>
        [Import("投保")]
        public int TB { get; set; }
        /// <summary>
        /// 置换
        /// </summary>
        [Import("置换")]
        public int ZH { get; set; }
        /// <summary>
        /// 按揭
        /// </summary>
        [Import("按揭")]
        public int AJ { get; set; }
        /// <summary>
        /// 延保
        /// </summary>
        [Import("延保")]
        public int YB { get; set; }


        [Import("套餐车销量")]
        [NotMapped]
        public int VersionCar { get; set; }

        /// <summary>
        /// 当日上旬套餐版本
        /// </summary>
        public int LstTenVersion { get; set; }
        /// <summary>
        /// 当日中旬套餐版本
        /// </summary>
        public int MidTenVersion { get; set; }
        /// <summary>
        /// 当日下旬套餐版本
        /// </summary>
        public int LastTenVersion { get; set; }

        /// <summary>
        /// 装潢车装潢台次
        /// </summary>
        [Import("装潢车装潢台次")]
        public int NotPackageDecorateCount { get; set; }
        /// <summary>
        /// 装潢车装潢金额
        /// </summary>
        [Import("装潢车装潢金额")]
        public decimal NotPackageDecorateValue { get; set; }


        [NotMapped]
        public bool IsLstTenVersion { get; set; }
        [NotMapped]
        public bool IsMidTenVersion { get; set; }
        [NotMapped]
        public bool IsLastTenVersion { get; set; }


        
        public void SetDate(DateTime date)
        {
            this.Date = date;
            if (this.Date.Day <= 10)
            {
                this.LstTenVersion = this.VersionCar;
            }
            else if (this.Date.Day <= 20)
            {
                this.MidTenVersion = this.VersionCar;
            }
            else
            {
                this.LastTenVersion = this.VersionCar;
            }
        }
    }
}
